import json

from config import BASE_PATH


def build_data(file_name):
    # 路径拼接
    file_path = BASE_PATH + "/data/" + file_name
    print(file_path)
    # 1.读取 文件file_name，转换为python的数据类型 json.load(f)
    with open(file_path, "r", encoding="utf-8") as fr:
        data = json.load(fr)
        # 2. 将[{},{}] -> [(),()]
        new_list = []
        for i in data:
            new_list.append(tuple(i.values()))
        # 3. 返回 [(),()]
        return new_list


if __name__ == '__main__':
    res = build_data("add_user.json")
    print(res)